package com.wiloon.java8x.tcp;

/**
 * Created by Administrator on 2015/7/29.
 */

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.ServerSocket;
import java.net.Socket;

public class Server {

    private static Logger logger = LoggerFactory.getLogger(Server.class);

    public static void main(String[] args) throws Exception {
        ServerSocket server = new ServerSocket(20006);
        Socket client = null;
        boolean flag = true;
        logger.debug("flag=" + flag);
        while (flag) {
            logger.debug("while loop start.");
            client = server.accept();
            logger.debug("connect to client success");
            new Thread(new ServerThread(client)).start();
        }
        server.close();
    }
}
